﻿using System;
using System.Linq;
using ForumsBrowser.BusinessObjects;
using System.Collections.Generic;

namespace ForumsBrowser.ObjectGateway
{
    internal static class TranslateMessagesAction
    {
        internal static List<Message> Execute(List<ForumsBrowser.DataObjects.Message> messages)
        {
            return messages.Select(message => new Message()
            {
                Abusive = message.Abusive,
                Answer = message.Answer,
                Body = message.Body,
                CreatedOn = message.CreatedOn.FromXmlToDateTime().Value,
                Deleted = message.Deleted,
                HasCode = message.HasCode,
                HelpfulVotes = message.HelpfulVotes,
                Id = message.Id,
                Root = message.Root,
                Status = message.Status,
                Subject = message.Subject,
                Url = message.Url,
            }).ToList();
        }
    }
}
